As
you've seen, SQL Azure is a relational database engine based on SQL
Server technology. It supports many of the features of SQL Server
including tables, primary keys, stored procedures, views, and much
more. This section gives a brief primer to get you started using SQL
Azure. You see how to register for Azure, how to create a database and
then an account, and how to log in.
1. Registering for Azure
To register for Windows Azure, visit the Pricing page on the Windows Azure web site: http://www.microsoft.com/windowsazure/offers/. Figure 1 shows some of the available options.
From this page, you have
the ability to pick the offer that best fits your profile and needs.
After you've chosen your preferred plan, click Buy, and follow the
onscreen instructions. When this is complete, you receive an e-mail
with instructions on how to configure your Windows Azure platform.
To access the Azure portal, you can use one of the following URLs. They all point to the same master portal:
When you create your Azure account, you're required to create an
administrator account for SQL Azure. This account is used to create
databases and other logins.
2. Creating a Database in SQL Azure
When the SQL Azure server is
created, the master database is provisioned automatically. This
database is read-only and contains configuration and security
information for your databases. You can then create your user
databases. You can either use the SQL Azure portal or issue a T-SQL
statement against the master database.
2.1. Using the SQL Azure Portal
One way to create a database is
to do so from the SQL Azure portal. From the Server Administration
screen, click Create Database at the bottom of the screen, as shown in Figure 2.
A small window opens, as shown in Figure 3.
Enter a database name, select a database edition (Web or Business),
specify the size of your database, and click Create. You can choose the
Web edition if 1GB or a 5GB is sufficient for you. If you need to
create larger databases, choose the Business edition, which lets you
select a size between 10GB and 50GB, in 10GB increments.
NOTE
The monthly fee varies,
depending on the size of the database. See the additional information
later in this chapter and the complete pricing information on
Microsoft's web site: www.microsoft.com/azure.
2.2. Using a T-SQL Command
Creating a new database
using a T-SQL command is straightforward. Because a database in SQL
Azure is managed by Microsoft, only a few options are available to you.
In addition, you must be connected to the master database to create new
databases.
To create a new database,
log in using the administrator account (or any user with the dbmanager
role), and run the following T-SQL command:
CREATE DATABASE mydatabase (MAXSIZE = 1 GB)
As previously discussed, the size of the database can be 1GB, 5GB, or 10GB–50GB. If the MAXSIZE parameter isn't defined, the size of the database is set to 1GB.